﻿/*
Copyright (c) 2009 Vratislav Cermak (vratacermak@gmail.com)
 
This file is part of TeachMe Project. See http://code.google.com/p/teach-me for more information.
 
TeachMe is an open source project. Using of TeachMe is free of charge.
It is distributed under GNU General Public License version 3 (GPLv3).
GPLv3 can be found at http://www.gnu.org/licenses/gpl.html.
 
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the license for more details.
*/

using System;
using System.Collections.Generic;

namespace TeachMe.Application.Themes
{
    public class Theme
    {
        public FragmentedImage Background { get; set; }
        public Progress Progress { get; set; }
        public List<Button> Buttons { get; set; }
        public List<Text> Texts { get; set; }
        public int TextsVerticalDistance { get; set; }
        public string Name { get; set; }
        public string Path { get; set; }
        public string Author { get; set; }

        public static int Version
        {
            get
            {
                return 1;
            }
        }

        public Text GetText(EntryTextType type)
        {
            foreach (Text text in Texts)
            {
                if (text.Type == type)
                {
                    return text;
                }
            }

            return null;
        }

        public Button GetButton(EntryButtonType type)
        {
            foreach (Button button in Buttons)
            {
                if (button.Type == type)
                {
                    return button;
                }
            }

            return null;
        }

        public override string ToString()
        {
            return String.IsNullOrEmpty(Author) ? Name : String.Format("{0} (by {1})", Name, Author);
        }
    }
}
